home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / PYR_CUBE.ZIP / pyr_cube.inc
Encoding:
Text File  |  1997-03-08  |  1.8 KB  |  59 lines

  1. // Persistence of Vision Ray Tracer Include File
  2. // File: pyr_cube.inc
  3. // Vers: 3.01e Watcom Win32
  4. // Desc: Creates a pyrimidal or "conical" type of cube
  5. // Date: March 8, 1997
  6. // Auth: Sonya Roberts
  7. // Note: Bottom and top must be flat (i.e., parallel)
  8. //       To use this fle, declare the four vectors
  9. //       and then include the file.  This can be done
  10. //       within an OBJECT{} or #DECLARE OBJECT{}
  11. //       statement if you so wish.
  12.  
  13.  
  14. // -- Define Defaults if Necessary
  15. #ifndef (bflc)    #declare bflc = <-1,-1,-1>    #end    // Bottom Front Left Corner
  16. #ifndef (bbrc)    #declare bbrc = <1,-1,1>    #end    // Bottom Back Right Corner
  17. #ifndef (tflc)    #declare tflc = <-.5,1,-.5>    #end    // Top Front Left Corner
  18. #ifndef (tbrc)    #declare tbrc = <.5,1,.5>    #end    // Top Back Right Corner
  19.  
  20. // -- Test Values
  21. #if (bflc.y != bbrc.y)
  22.     #fatal "The bottom of your cube is not flat.  The y-values of bflc and bbrc must be identical."
  23. #end
  24. #if (tflc.y != tbrc.y)
  25.     #fatal "The top of your cube is not flat.  The y-values of tflc and tbrc must be identical."
  26. #end
  27.  
  28. // -- define remaining corners based on these four
  29. #declare bblc = <bflc.x, bflc.y, bbrc.z>    // Bottom Back Left Corner
  30. #declare bfrc = <bbrc.x, bbrc.y, bflc.z>    // Bottom Front Right Corner
  31. #declare tblc = <tflc.x, tflc.y, tbrc.z>    // Top Back Left Corner
  32. #declare tfrc = <tbrc.x, tbrc.y, tflc.z>    // Top Front Right Corner
  33.  
  34. mesh {
  35.     // TOP
  36.     triangle {tflc, tfrc, tbrc}
  37.     triangle {tbrc, tblc, tflc}
  38.     
  39.     // BOTTOM
  40.     triangle {bflc, bfrc, bbrc}
  41.     triangle {bbrc, bblc, bflc}
  42.  
  43.     // LEFT
  44.     triangle {bflc, tflc, tblc}
  45.     triangle {tblc, bblc, bflc}
  46.     
  47.     // RIGHT
  48.     triangle {bfrc, tfrc, tbrc}
  49.     triangle {tbrc, bbrc, bfrc}
  50.     
  51.     // FRONT
  52.     triangle {bflc, bfrc, tfrc}
  53.     triangle {tfrc, tflc, bflc}
  54.     
  55.     // BACK
  56.     triangle {bblc, bbrc, tbrc}
  57.     triangle {tbrc, tblc, bblc}
  58. }